/*
 * @Author: ayun chengyunwu@jiatui.com
 * @Date: 2023-07-17 17:49:20
 * @LastEditors: ayun chengyunwu@jiatui.com
 * @LastEditTime: 2023-07-28 11:38:26
 * @FilePath: /ift-economy-network-h5/src/pages/InvestmentScheduling/components/ProjectContact/index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useEffect, useState } from 'react'
import ListGroup, { ListGroupItem } from '../ListGroup'
import { PropsT } from '../BasicInformation'
import { getProjectContactInfo } from '@/service/InvestmentScheduling'

type DataInfoT = {
  leaderInCharge?: string
  businessSubLeader?: string
  departTakeLeader?: string
  departRespLeader?: string
  departRespLeaderContact?: string
  departAttache?: string
  departAttacheContact?: string
  streetTakeLeader?: string
  streetRespLeaderContact?: string
}

const index = ({ id }: PropsT) => {
  const [dataInfo, setDataInfo] = useState<DataInfoT>({})

  // 获取详情
  const getDetails = async () => {
    console.log('项目联系人')
    const res = await getProjectContactInfo({ projectName: id, statDate: "2023-07" })
    console.log(res);
  }

  useEffect(() => {
    getDetails()
    return () => { }
  }, [])

  return (
    <>
      <ListGroup>
        <ListGroupItem
          title="挂点督导区领导"
          paragraph={dataInfo.leaderInCharge}
        />
        <ListGroupItem
          title="业务分管区领导"
          paragraph={dataInfo.businessSubLeader}
        />
        <ListGroupItem
          title="责任部门牵头领导"
          paragraph={dataInfo.departTakeLeader}
        />
      </ListGroup>
      <ListGroup>
        <ListGroupItem
          title="责任部门责任领导(处级)"
          paragraph={dataInfo.departRespLeader}
        />
        <ListGroupItem
          title="联系方式"
          paragraph={dataInfo.departRespLeaderContact}
        />
      </ListGroup>
      <ListGroup>
        <ListGroupItem
          title="责任部门项目专员"
          paragraph={dataInfo.departAttache}
        />
        <ListGroupItem
          title="联系方式"
          paragraph={dataInfo.departAttacheContact}
        />
      </ListGroup>
      <ListGroup>
        <ListGroupItem
          title="责任街道牵头领导"
          paragraph={dataInfo.streetTakeLeader}
        />
        <ListGroupItem
          title="责任部门责任领导(处级)"
          paragraph={dataInfo.departRespLeader}
        />
        <ListGroupItem
          title="联系方式"
          paragraph={dataInfo.streetRespLeaderContact}
        />
      </ListGroup>
    </>
  )
}

export default index
